import { _decorator, Component, log, Node, RigidBody2D, v2, Vec2 } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('PlayCotrol')
export class PlayCotrol extends Component {

    @property(RigidBody2D)
    BodyRigBody: RigidBody2D = null;

    force: Vec2 =null;

    speed: number=700;

    start() {
        // let wp = new Vec2()
        // // 获取目标本地坐标系下的世界坐标值，第一个参数v2(0, 0)表示刚体本地坐标，wp为对应的世界坐标
        // this.BodyRigBody.getLocalPoint(new Vec2(-1, 0), wp);

       
    }

    update(deltaTime: number) {
        this.force=v2(this.speed*deltaTime, 0);
        this.BodyRigBody.applyForceToCenter(this.force, true);
    }
}


